package org.eenie.hookui.utils

import android.app.ActivityManager
import android.content.Context

object ProcessUtils {
    fun isMainProcess(app: Context): Boolean {
        val am = app.getSystemService(Context.ACTIVITY_SERVICE) as ActivityManager
        val pid = android.os.Process.myPid()
        val pkg = app.packageName
        am.runningAppProcesses.forEach {
            if (pid == it.pid && it.processName == pkg) {
                return true
            }
        }
        return false
    }
}